package cn.vin.bean;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;

public class BeanRegistyEngine {
    public static void main(String[] args) {
        ClassPathResource resource = new ClassPathResource("bean/bean.xml"); // <1>
        DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); // <2>
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); // <3>
        reader.loadBeanDefinitions(resource);
        Address address = (Address) factory.getBean("address");
        System.out.println(address);
        address = (Address) factory.getBean("address");
        System.out.println(address);
    }
}
